package game;

import java.awt.geom.Point2D;

public class Camera {
	
	private static Camera instance;
	
	Point2D worldPosition;
	
	int viewportWidth = 800;
	int viewportHeight = 500;
	
	int worldWidth = 1600;
	int worldHeight = 1000;
	
	public static Camera getInstance()
	{
		if (instance == null)
			instance = new Camera();
		return instance;
	}
	
	public void SetWorldPosition(Point2D worldPosition)
	{
		this.worldPosition = worldPosition;
	}
	
	public void MoveCamera(float X, float Y)
	{
		this.worldPosition = new Point2D.Double(this.worldPosition.getX() + X,
												this.worldPosition.getY() + Y);
		
		
		this.worldPosition = new Point2D.Double(Math.max(Math.min(this.worldPosition.getX(), 800), 0),
												Math.max(Math.min(this.worldPosition.getY(), 500), 0));
	}
}
